package io.sqrtqiezi.spark.wordcount

import org.apache.spark.{SparkConf, SparkContext}

object WordCount {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local").setAppName("WordCont")
    val sc = new SparkContext(conf)

    //    val lines = sc.textFile("hdfs://izuf66rzw9m809spfn9yucz:9000/wcinput/wc.txt")
    val lines = sc.textFile("data/wc.txt")

    lines.flatMap(_.split(" ")).map((_, 1)).reduceByKey(_ + _).collect().foreach(println)

    sc.stop()
  }
}
